import '../../toolkit/utils/loading.dart';
import 'exception.dart';
import 'exception_handler.dart';

Future request(
  Function() block, {
  bool showLoading = true,
  String? message,
  bool Function(ApiException)? onError,
}) async {
  try {
    await loading(block, isShowLoading: showLoading, message: message);
  } catch (e) {
    handleException(ApiException.from(e), onError: onError);
  }
  return;
}
